package com.huangyong.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huangyong.dao.CommentMapper;
import com.huangyong.entity.Comment;
import com.huangyong.service.CommentService;

@Service
public class CommentServiceImpl implements CommentService {

	@Autowired
	private CommentMapper commentMapper;
	
	@Override
	public String delete(int id) {
		if(commentMapper.delete(id)==1) {
			return "success";
		}
		return "failed";
	}

	@Override
	public String insert(Comment comment) {
		if(commentMapper.insert(comment)==1) {
			return "success";
		}
		return "failed";
	}

	@Override
	public Comment findById(int id) {
		return commentMapper.findById(id);
	}

	@Override
	public List<Comment> findAll(int aid) {
		return commentMapper.findAll(aid);
	}

}
